{% load i18n %}
<div class="week-calendar">
    {% for day in days %}
        <details class="weekday {% if day.events %}has-events{% else %}no-events{% endif %} {% if day.today %}today{% endif %}"
                data-date="{{ day.date|date:"SHORT_DATE_FORMAT" }}" open>
            <summary>
                <h3><span class="fa fa-fw" aria-hidden="true"></span> {{ day.day_formatted }}</h3>
            </summary>
            <div class="events">
                {% for event in day.events %}
                    <a class="event {% if event.continued %}continued{% else %} {% spaceless %}
    {% if event.event.presale_is_running and show_avail %}
        {% if event.event.best_availability_state == 100 %}
            available
        {% elif event.event.settings.waiting_list_enabled and event.event.best_availability_state >= 0 %}
            waitinglist
        {% elif event.event.best_availability_state == 20 %}
            reserved
        {% elif event.event.best_availability_state < 20 %}
            soldout
        {% endif %}
    {% elif event.event.presale_is_running %}
        running
    {% elif event.event.presale_has_ended %}
        over
    {% elif event.event.settings.presale_start_show_date and event.event.presale_start %}
        soon
    {% else %}
        soon
    {% endif %}
{% endspaceless %}{% endif %}"
                            href="{{ event.url }}">
                        {% if show_names|default_if_none:True %}
                            <span class="event-name">
                                {{ event.event.name }}
                            </span>
                        {% endif %}
                        {% if not event.continued %}
                            {% if event.time %}
                                <span class="event-time" data-time="{{ event.event.date_from.isoformat }}" data-timezone="{{ event.timezone }}" data-time-short>
                                    <span class="fa fa-clock-o" aria-hidden="true"></span>
                                    {% if not show_names|default_if_none:True %}
                                        <strong>
                                    {% endif %}
                                    {{ event.time|date:"TIME_FORMAT" }}
                                    {% if event.time_end %}
                                        – {{ event.time_end|date:"TIME_FORMAT" }}
                                    {% endif %}
                                    {% if not show_names|default_if_none:True %}
                                        </strong>
                                    {% endif %}
                                    {% if multiple_timezones %}
                                        {{ event.timezone }}
                                    {% endif %}
                                </span>
                            {% endif %}
                            <span class="event-status">
                                {% if event.event.presale_is_running and show_avail %}
                                    {% if event.event.best_availability_state == 100 %}
                                        <span class="fa fa-ticket" aria-hidden="true"></span> {% trans "Book now" %}
                                    {% elif event.event.settings.waiting_list_enabled and event.event.best_availability_state >= 0 %}
                                        <span class="fa fa-ticket" aria-hidden="true"></span> {% trans "Waiting list" %}
                                    {% elif event.event.best_availability_state == 20 %}
                                        <span class="fa fa-ticket" aria-hidden="true"></span> {% trans "Reserved" %}
                                    {% elif event.event.best_availability_state < 20 %}
                                        {% if event.event.has_paid_item %}
                                            <span class="fa fa-ticket" aria-hidden="true"></span> {% trans "Sold out" %}
                                        {% else %}
                                            <span class="fa fa-ticket" aria-hidden="true"></span> {% trans "Fully booked" %}
                                        {% endif %}
                                    {% endif %}
                                {% elif event.event.presale_is_running %}
                                    <span class="fa fa-ticket" aria-hidden="true"></span> {% trans "Book now" %}
                                {% elif event.event.presale_has_ended %}
                                    <span class="fa fa-ticket" aria-hidden="true"></span> {% trans "Sale over" %}
                                {% elif event.event.settings.presale_start_show_date and event.event.presale_start %}
                                    <span class="fa fa-ticket" aria-hidden="true"></span>
                                    {% blocktranslate with start_date=event.event.presale_start|date:"SHORT_DATE_FORMAT" trimmed %}
                                        from {{ start_date }}
                                    {% endblocktranslate %}
                                {% else %}
                                    <span class="fa fa-ticket" aria-hidden="true"></span> {% trans "Soon" %}
                                {% endif %}
                            </span>
                        {% endif %}
                    </a>
                {% endfor %}
            </div>
        </details>
    {% endfor %}
</div>
